package cn.iocoder.yudao.module.reading.enums.recommendation;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 推荐内容类型枚举
 *
 * @author 芋道源码
 */
@AllArgsConstructor
@Getter
public enum ContentTypeEnum {

    BOOK_SET("book_set", "绘本集"),
    BOOK("book", "绘本"),
    AUDIO("audio", "音频");

    /**
     * 类型代码
     */
    private final String code;
    /**
     * 类型名称
     */
    private final String name;

    public static ContentTypeEnum fromCode(String code) {
        for (ContentTypeEnum type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }

}
